﻿/*
-----------------------------------------------
    Rodeo Game Engine
    Rodeo Primitive Module
    Geometry.h file
    Copyright(c) Marcin Goryca
-----------------------------------------------
*/
#ifndef RODEO_PRIMITIVE_GEOMETRY_H_
#define RODEO_PRIMITIVE_GEOMETRY_H_

//#ifndef RODEO_ENTITY_ENTITY_H_
//#include "entity\entity.h"
//#endif    //RODEO_ENTITY_ENTITY_H_

#ifndef RODEO_RENDERER_RENDERMODE_H_
#include "renderer\rendermode.h"
#endif    //RODEO_RENDERER_RENDERMODE_H_

#ifndef RODEO_ENTITY_MODEL3D_H_
#include "entity\model3d.h"
#endif    //RODEO_ENTITY_MODEL3D_H_

#ifndef RODEO_MATH_VECTOR3_H_
#include "math\vector3.h"
#endif    //RODEO_MATH_VECTOR3_H_

namespace rodeoprimitive
{
class RenderBuffers
{
public:
    ~RenderBuffers(){}
    rodeocore::ui vb;
    rodeocore::ui nb;
    rodeocore::ui tb;
    rodeocore::ui ib;
protected:
    RenderBuffers(){}
};

// ---- CUBE ---- //
class Cube : public rodeoentity::Model3D
{
    Cube(){}
    virtual ~Cube(){}

    virtual void draw();
    void build();
    void build(const rodeomath::Vector3& v1, const rodeomath::Vector3& v2);

private:	
// ---- < MEMBERS > ---- //
    float vertex_array_[24];
    float vertex_data_[8];
    rodeocore::us vertex_indices_[24];
    float texture_uvs_array_[48];
    float normal_array_[24];
};

// ---- LINE ---- //
struct Line : public rodeoentity::Entity
{
    Line(){}
    virtual ~Line(){}

    rodeomath::Vector3 start;
    rodeomath::Vector3 end;

    virtual void draw();
    void draw(float x, float y);
};

// ---- POINT ---- //
struct Point : public rodeoentity::Entity
{
    virtual ~Point(){}
    virtual void draw();
    virtual void setPosition(float px, float py, float pz);

//==== MEMBERS ====//
    float x_;
    float y_;
    float size_;
};

// ---- SPHERE ---- //
class Sphere : public rodeoentity::Entity
{
public:
    Sphere(){}

    ~Sphere(){}

};

// ---- GRID ---- //
struct Grid : public rodeoentity::Model3D
{

    // override method from RodeoCore::Entity 
    virtual void draw();
    void translate(float x, float y, float z);

    //	
    // Generates grid
    // Parameter n - how many quads in x axis
    // Parameter m - how many quads in z axis
    void generate(rodeocore::us n, rodeocore::us m);

    // Generates grid 
    // Parameter qw, qh - width and height of single quad 
    void generate(rodeocore::us n, rodeocore::us m, float qw, float qh);

    // size of one quad in x 
    float quad_x;

    // size of one quad in z 
    float quad_z;

    // size of whole grid in x 
    float size_in_x;

    // size of whole grid in z 
    float size_in_z;

    // how many quads in a row (width) \n
    // width = (row_quads - 1) * quad_x
    float row_quads;

    // how many quads in a column (depth)
    //depth = (column_quads - 1) * quad_z
    float column_quads;

};

class Geometry
{
public:
    Geometry(){}

    ~Geometry(){}
};

}    //end of rodeoprimitive namespace
#endif  //RODEO_GEOMETRY_GEOMETRY_H_